﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Specialized;

namespace Transcend.DP3.Helper
{
    /// <summary>
    /// 用作应用程序配置
    /// </summary>
    public class DictionaryConfiguration
    {

        private HybridDictionary dictionary = null;

        public HybridDictionary Dictionary
        {
            get { return dictionary; }
            set { dictionary = value; }
        }

        public string GetString(string key)
        {
            if (string.IsNullOrEmpty(key)) return string.Empty;
            return TypeHelper.Try<string>(dictionary[key]);
        }

        public int GetInt32(string key, int def)
        {
            return TypeHelper.Try<int>(GetString(key), def);
        }

        public decimal GetDecimal(string key, decimal def)
        {
            return TypeHelper.Try<decimal>(GetString(key), def);
        }

        public double GetDouble(string key, double def)
        {
			return TypeHelper.Try<double>(GetString(key), def);
        }

    }
}
